package com.sfeir.tv.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.sfeir.tv.client.mvc.framework.Controller;
import com.sfeir.tv.client.mvc.framework.Triad;
import com.sfeir.tv.client.mvc.framework.impl.gwt.GWTView;
import com.sfeir.tv.client.ui.container.ContainerModel;
import com.sfeir.tv.client.ui.container.ContainerView;
import com.sfeir.tv.client.ui.search.ItemModel;
import com.sfeir.tv.client.ui.search.ItemView;
import com.sfeir.tv.client.ui.search.ListModel;
import com.sfeir.tv.client.ui.search.ListView;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class YourTV implements EntryPoint
{
    public void onModuleLoad()
    {

        /**Create ContainerTriad and add its view to RootPanel**/
        Triad containerTriad = new Triad( new ContainerModel(), new ContainerView(), new Controller() );
        RootPanel.get().add( ( (Widget) containerTriad.getView() ), 0, 0 );
        ( (Widget) containerTriad.getView() ).setSize( "100%", "100%" );

        /**Create SearchListTriad and add its view to ContainerTriad's view**/
        Triad searchListTriad = new Triad( containerTriad.getController(), new ListModel(), new ListView(), new Controller() );
        ( (ContainerView) containerTriad.getView() ).addList( (Widget) searchListTriad.getView() );
        ( (Widget) searchListTriad.getView() ).setWidth( "100%" );

        /**Create Item1Triad and add its view to SearchListTriad's view**/
        ItemModel itemModel = new ItemModel("http://storage02.brainsonic.com/webtv/tv4it/contents/2007/20071218_112407/thumbnail.jpg", "5' with Dion Almaer", "Dion Almaer, co-fondateur d'Ajaxian.com, travaille désormais pour Google sur le projet Gears. Architecte, expert reconnu des technologies Ajax et de J2EE, il livre au micro de Didier Girard sa vision de Gears, de Google Web Toolkit (GWT) et de l'évolution de Javascript.",
        		               "http://storage02.brainsonic.com/streaming.php?file=webtv/tv4it/contents/2007/20071218_112407/preview.flv");
        Triad itemOneTriad = new Triad( searchListTriad.getController(), itemModel, new ItemView(), new Controller() );
        ( (GWTView) searchListTriad.getView() ).addComponent( (Widget) itemOneTriad.getView() );
        ( (Widget) itemOneTriad.getView() ).setSize( "100%", "120px" );

        
        itemModel = new ItemModel("http://storage02.brainsonic.com/webtv/tv4it/contents//2007/20070117_00001/photo.jpg", "Mark Reinhold : Java 6, Java Open Source et Java 7", "Mark Reinhold, Chief Engineer for the Java 2 Platform, aborde l'intérêt de JavaSE 6, décrit l'apport du passage de Java en Open Source pour les utilisateurs, explique le choix de la GPL,...",
	              // "http://storage02.brainsonic.com/streaming.php?file=webtv/tv4it/contents/2006/20061224_00001/preview.flv");
                "http://storage02.brainsonic.com/streaming.php?file=webtv/tv4it/contents//2007/20070117_00001/20070117_00001.flv");

        Triad itemTwoTriad = new Triad( searchListTriad.getController(), itemModel, new ItemView(), new Controller() );
        ( (GWTView) searchListTriad.getView() ).addComponent( (Widget) itemTwoTriad.getView() );
        ( (Widget) itemTwoTriad.getView() ).setSize( "100%", "120px" );
//        http://storage02.brainsonic.com/streaming.php?file=webtv/tv4it/contents//2007/20070117_00001/20070117_00001.flv

        /**Create Item2Triad and add its view to SearchListTriad's view**/
        itemModel = new ItemModel("http://storage02.brainsonic.com/webtv/tv4it/contents//2006/20061224_00001/photo.jpg", "JBoss est la société à abattre", "Pour Marc, JBoss est la société à abattre. C'est pourquoi il a animé sa keynote de JavaPolis en 'Flavor Flav', rappeur, membre du groupe Public Enemy.",
        		              // "http://storage02.brainsonic.com/streaming.php?file=webtv/tv4it/contents/2006/20061224_00001/preview.flv");
                              "http://storage02.brainsonic.com/streaming.php?file=webtv/tv4it/contents/2006/20061224_00001/20061224_00001.flv");

        Triad itemthreeTriad = new Triad( searchListTriad.getController(), itemModel, new ItemView(), new Controller() );
        ( (GWTView) searchListTriad.getView() ).addComponent( (Widget) itemthreeTriad.getView() );
        ( (Widget) itemthreeTriad.getView() ).setSize( "100%", "120px" );

        //http://storage02.brainsonic.com/streaming.php?file=webtv/tv4it/contents/2007/20070406_00001/20070406_00001.flv
        itemModel = new ItemModel("http://storage02.brainsonic.com/webtv/tv4it/contents//2007/20070406_00001/photo.jpg", "Passé, présent et future de Spring avec Rod Johnson", "Rod Johnson, leader du projet Spring, explique pourquoi il a créé Spring, en quoi consiste ce projet, de quoi il est constitué. Vous y apprendrez que Rod voit Spring comme une simplification de J2EE.",
	              // "http://storage02.brainsonic.com/streaming.php?file=webtv/tv4it/contents/2006/20061224_00001/preview.flv");
                "http://storage02.brainsonic.com/streaming.php?file=webtv/tv4it/contents//2007/20070406_00001/20070406_00001.flv");

        Triad itemfourTriad = new Triad( searchListTriad.getController(), itemModel, new ItemView(), new Controller() );
        ( (GWTView) searchListTriad.getView() ).addComponent( (Widget) itemfourTriad.getView() );
        ( (Widget) itemfourTriad.getView() ).setSize( "100%", "120px" );

        
    }

}
